package com.gtw.modules.api.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.gtw.common.annotation.AuthIgnoreApi;
import com.gtw.common.utils.Query;
import com.gtw.common.utils.R;
import com.gtw.modules.api.service.TbCategoryService;
import com.gtw.modules.entity.TbCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 分类控制器
 *
 * @author wuye
 * @email www.baidu.com
 * @date 2018-02-06 15:19:47
 */
@RestController
@RequestMapping("/api/category")
public class TbCategoryController {
    @Autowired
    private TbCategoryService tbCategoryService;

    /**
     * 查询列表
     *
     * @returnapi
     */
    @AuthIgnoreApi
    @RequestMapping("/list")
    public R list() {
        List<TbCategory> page = tbCategoryService.findALL();
        return R.ok().put("data", page);
    }

    /**
     * 信息
     */
    @AuthIgnoreApi
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id) {
        TbCategory tbCategory = tbCategoryService.selectByPrimaryKey(id);

        return R.ok().put("tbCategory", tbCategory);
    }


}
